package com.zhongbei.service.impl;

import com.zhongbei.mapper.NewsMapper;
import com.zhongbei.pojo.New;
import com.zhongbei.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class NewsServiceImpl implements NewsService {
    @Autowired
    private NewsMapper newsMapper;

    @Override
    public int addNews(New news){
        news.setDate(new Date());
        int i = newsMapper.addNews(news);
        return i;
    }
    @Override
    public int deleteNews(int id){
        int i = newsMapper.deleteNews(id);
        return i;
    }
    @Override
    public int changeNews(New news){
        int i= newsMapper.changeNews(news);
        return i;
    }
    @Override
    public List<New> getNews(){
        List<New> i=newsMapper.getNews();
        return i;
    }
    @Override
    public List<New> searchNews(String keyword){
        List<New> i=newsMapper.searchNews(keyword);
        return i;
    }
}
